﻿namespace MSRI.HelperClasses
{
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    [Serializable]
    public class SmsResponseClass
    {
        private ResponseSessionStateEnum _sessionState;
        public List<SmsClass> ResponseMessages;

        public SmsResponseClass()
        {
            this.ResponseMessages = new List<SmsClass>();
            this._sessionState = ResponseSessionStateEnum.Ignore;
        }

        public SmsResponseClass(SmsClass SmsItem)
        {
            this.ResponseMessages = new List<SmsClass>();
            this.ResponseMessages.Add(SmsItem);
            this._sessionState = ResponseSessionStateEnum.Ignore;
        }

        public SmsResponseClass(SmsResponseClass Item)
        {
            this.ResponseMessages = new List<SmsClass>(Item.ResponseMessages);
            this._sessionState = Item.SessionState;
        }

        public void AddResponseSms(SmsClass SmsItem)
        {
            if (this.ResponseMessages == null)
            {
                this.ResponseMessages = new List<SmsClass>();
            }
            this.ResponseMessages.Add(SmsItem);
        }

        public int Count
        {
            get
            {
                if ((this.ResponseMessages != null) && (this.ResponseMessages.Count != 0))
                {
                    return this.ResponseMessages.Count;
                }
                return 0;
            }
        }

        public SmsClass this[int index]
        {
            get
            {
                if ((this.ResponseMessages != null) && (this.ResponseMessages.Count > index))
                {
                    return this.ResponseMessages[index];
                }
                return null;
            }
        }

        public ResponseSessionStateEnum SessionState
        {
            get
            {
                return this._sessionState;
            }
            set
            {
                this._sessionState = value;
            }
        }

        public ResponseClassEnum Type
        {
            get
            {
                if ((this.ResponseMessages == null) || (this.ResponseMessages.Count == 0))
                {
                    return ResponseClassEnum.Ignore;
                }
                if (this.ResponseMessages.Count == 1)
                {
                    return ResponseClassEnum.Single;
                }
                return ResponseClassEnum.Multiple;
            }
        }
    }
}

